Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

197
Visualizações
How Create an event handler for event "resize"?

when alternating the display on the browser (F12) from mobile or responsive to desktop the div (content_filter) disappears.. refresh the page to fix the bug.

Desktop view

Desktop mode

from what I understand I need to add a Window: resize event to avoid refreshing each time. my level in javascript is completely beginner. can you show me the correct technique with my code?

<script>

        document.addEventListener('DOMContentLoaded', function () {
            jQuery(function ($) {

                $('.filter_btn').click(function (event) {
                    if (window.innerWidth <= 768) {
                        $('.content_filter').slideToggle('250', 'swing', 'hide');
                    }
                });
            });
        });
    </script>

    <style >
        @media all and(max - width: 768 px) {
            .content_filter {
                display: none;
            }
        } 
</style>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use:

window.addEventListener('resize', function () {
console.log(window.innerHeight);
});

check https://developer.mozilla.org/en-US/docs/Web/API/Window/resize_event for further informaion.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda